package com.github.bobjoy.java.jdk8.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.Collection;

public class Annotations {

    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
    public @interface NotEmpty{}

    public static class Holder<@NotEmpty T> extends ArrayList<T>{
        public void method() throws @NotEmpty Exception {

        }
    }

    public static void main(String[] args) {
        final Holder holder = new @NotEmpty Holder();
        @NotEmpty Collection<@NotEmpty String> col = new ArrayList<>();
    }

}
